package com.ruige.goreka.dao;

import com.ruige.goreka.pojo.Service;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

public interface GorekaMapper extends Mapper<Service> {

    @Delete("DELETE FROM tb_services")
    void deleteAll();

    @Select({"select * from tb_services where service_name=#{service_name}"})
    Service findByServiceName(@Param("service_name") String serviceName);

    @Update("UPDATE tb_services SET last_update_time=#{last_update_time},status=#{status} WHERE service_name=#{service_name}")
    void updateByServiceName(Service service);

    @Update("UPDATE tb_services SET status=#{status} WHERE service_name=#{service_name}")
    void updateStatusByServiceName(Service service);
}
